import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';

import '/constant/app_info.dart';
import '/page/home/home_view.dart';
import 'init_app.dart';
import 'util/logger_util.dart';

void main() {
  runApp(MyApp());
  InitApp.init();
  InitApp.getAppInfo();
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final botToastBuilder = BotToastInit();
    return GetMaterialApp(
      title: AppInfo.appTitle,
      theme: ThemeData(
        primaryColor: Colors.white,
      ),
      builder: (context, child) { //do something
        child = botToastBuilder(context,child);
        return child;
      },
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      // 配置多语言列表
      supportedLocales: [Locale("zh"),Locale("en")],
      localeListResolutionCallback: (locales, supportedLocales) {
        logger('$locales',tag: "当前系统语言环境");
        return;
      },
      home: HomePage(),
    );
  }
}